<link href="/css/bootstrap.min.css" rel="stylesheet"/>  
<!--script admin-table-->
<!--
<script type="text/javascript">
	//Tipsy Tooltips
	$('.tooltip').tipsy({fade: true});
	$('.tooltip.north').tipsy({fade: true, gravity: 's'});
	$('.tooltip.east').tipsy({fade: true, gravity: 'w'});
	$('.tooltip.west').tipsy({fade: true, gravity: 'e'});
	// Form Tooltips
	$('form [title]').tipsy({fade: true, trigger: 'focus', gravity: 'w'});
	// Check all checkboxes when the one in a table head is checked:

	 $(function () { // this line makes sure this code runs on page load
	 	$('.check-all').click(function () {
	 		$(this).parents('table:eq(0)').find(':checkbox').attr('checked', this.checked);
	 	});
	 });
</script>
-->
<script type="text/javascript">
     $(document).ready( function()
	      {
		    	 $("#add_account").click(function()
		    			 {
		    	    	 name = $("#name").val();
		    	         if(name == "") alert("Không được để trống ô Name");
		    	         email = $("#email").val();
		    	         if(email == "") alert("Không được để trống ô Email");
		        	         
		    			 }
		    	  )
	      });
</script>
	      
<div id='formadd'>
<form id="form1" name="form1" method="post" action="">
  <table width="800" border="0">
    <tr>
      <td width="115" height="45">Name</td>
      <td width="263"><label>
        <input name="name" type="text" id="name" size="30" />
      </label></td>
      <td width="121">Sunnet-email</td>
      <td width="283"><input name="email"  type="text" id="email" size="30" /></td>
    </tr>
    <tr>
      <td height="33">Role</td>
      <td colspan="2"><select name="role" id="role">
                        <option value="Moderator" >Moderator</option>
                        <option value="Admin"  >Admin</option>
                      </select></td>
      <td><input class="btn btn-primary" type="submit" name="submit" value="ADD" id="add_account"/></td>
    </tr>
  </table>
  <label></label>
</form>
</div>
<div id='formnew'></div>

<table width="100%" cellspacing="0" cellpadding="2" border="0">
	
		<tr>
			<td align="left"><input type="button" class="btn btn-primary" width='30'  value="Add new account" id='new' name='new' onclick='showFormAdd()'></td>
			
		</tr>

</table>



<?php 
$list = $this->datas;
if($list){
?>


<div class="grid_9" id="dashtabs">
<div class="box-header"> Acount Manager</div>
<div id="dashtabs-pages" class="box-content no-padding">

<table width="100%" cellspacing="0" cellpadding="4" border="0" class="table no-border">
	 <thead>
		<tr align="center" >
	    		<td width="20%" align="center"> Name </td>
	    		<td width="20%" align="center"> Sunnet-mail </td>
				<td width="20%" align="center"> Role </td>
				<td width="5%" align="center"> Edit </td>
				<td width="5%" align="center"> Delete </td>
				<td width="5%" align="center"> Status </td>
			</tr>
		 </thead>
		<tbody>
			<?php 			
			foreach ($list as $key => $value) {
			//	echo $key;
				echo ($key % 2 == 0)?("<tr class='' id = '".$value['id']."'>"):("<tr class='alt' id = '".$value['id']."'>");
				echo "<td align='center'>".$value['name']."</td>";
				echo "<td align='center'>".$value['sunnet_email']."</td>";
				echo "<td align='center'>".$value['role']." </td>";
				echo "<td align='center'><img src='/images/adminbase/edit.png' width=32 height=32 onclick='edit_acount(".$value['id'].")'></td>";
				echo "<td align='center'><img src='/images/adminbase/delete.png' width=32 height=32 onclick='delete_acount(".$value['id'].")'></td>";
				?>
				<td align='center'> <?php if($value['status'] == 1) echo "<button type='button' class='btn btn-primary'  onclick=edit_status(".$value['id'].",".$value['status'].") id='ma".$value['id']."'>ON</button>";
				                                                    else echo "<button type='button' class='btn btn-danger'  onclick=edit_status(".$value['id'].",".$value['status'].") id='ma".$value['id']."'>OFF</button>"; ?>
				 </td>
				<?php 
				echo "</tr>";
			}
			?>
	</tbody>
</table>
     

</div>
<div class="box-footer"> <span class="txt-smaller txt-light">Showing <?php echo count($list);?> results </span></div>
</div>

<?php 
}
?>